//
//Creation History
// NAME:    DivisionOptions
// TITLE:   Selection Box of Division id
// BY:      Miranda
// DATE:    13/08/2004  CRLOG 1347
//
package admin.options;

import com.ffpc.html.Options;

import java.util.ArrayList;
import java.sql.Connection;

import admin.system.division.*;

public class DivisionOptions
  extends Options
{
  private String division_id;
  /**
   * Constructor
   */
  public DivisionOptions()
  {
      this.load();
  } 

  @Override
protected ArrayList createOptions(Connection con)
    throws Exception
  {
      ArrayList options = new ArrayList();
      DivisionBean div = DivisionProcess.createBean();
      div.setDivision_id("");
      DivisionBean[] division = DivisionProcess.find(con,div);
      for (int i=0; i<division.length; i++)
      {
          Options.Option option
          = new Options.Option( division[i].getDivision_id(),
                                division[i].getDivision_name());
          options.add(i,option);
      }
      return options;
  }

  @Override
public String getOptions(String value)
  {
      StringBuffer htmlOptions = new StringBuffer();
//      Option nullOption = new Option("","");
//      htmlOptions.append(nullOption.getHtml(value));
      for (int i=0; this.options!=null && i<this.options.size(); i++)
      {
          Option option = (Option)options.get(i);
          htmlOptions.append(option.getHtml(value));
      }
      return htmlOptions.toString();
  } 
}


